#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

//Author, keneth
int main(void)
{
	int fd;
	char ch;
	
	if((fd=open("/dev/gpio_switch",O_RDWR))<0)
	{
		printf("can not open gpio_switch device.\n");
		return -1;
	}
	else
		printf("open gpio_switch device is ok.\n");

	while(1)
	{
		ch=0x7f;
		write(fd,&ch,1);
		read(fd,&ch,1);
		printf("%c\n",ch);
		sleep(2);

		ch=0x00;
		write(fd,&ch,1);
		read(fd,&ch,1);
		printf("%c\n",ch);
		sleep(2);
	}
    printf("version2.0");
	return 0;
}
